
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
@types/big.js
Advanced tools
TypeScript definitions for big.js
@types/big.js provides TypeScript type definitions for the big.js library, which is used for arbitrary-precision decimal arithmetic in JavaScript.
Basic Arithmetic Operations
This feature allows you to perform basic arithmetic operations such as addition, subtraction, multiplication, and division with arbitrary precision.
const Big = require('big.js');
const a = new Big(0.1);
const b = new Big(0.2);
const sum = a.plus(b); // 0.3
const difference = a.minus(b); // -0.1
const product = a.times(b); // 0.02
const quotient = a.div(b); // 0.5
Comparison Operations
This feature allows you to compare two Big numbers using methods like eq (equal), gt (greater than), and lt (less than).
const Big = require('big.js');
const a = new Big(0.1);
const b = new Big(0.2);
const isEqual = a.eq(b); // false
const isGreaterThan = a.gt(b); // false
const isLessThan = a.lt(b); // true
Rounding
This feature allows you to round a Big number to a specified number of decimal places.
const Big = require('big.js');
const a = new Big(1.2345);
const rounded = a.round(2); // 1.23
Conversion to String
This feature allows you to convert a Big number to a string representation.
const Big = require('big.js');
const a = new Big(1.2345);
const str = a.toString(); // '1.2345'
decimal.js is another library for arbitrary-precision decimal arithmetic. It offers more features compared to big.js, such as support for complex mathematical functions and configuration options for precision and rounding.
bignumber.js is a library for arbitrary-precision arithmetic with a focus on performance. It provides similar functionality to big.js but is optimized for speed and efficiency.
mathjs is a comprehensive mathematics library that includes support for arbitrary-precision arithmetic along with a wide range of other mathematical functions and utilities. It is more feature-rich compared to big.js but also larger in size.
npm install --save @types/big.js
This package contains type definitions for big.js (https://github.com/MikeMcl/big.js/).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/big.js.
These definitions were written by Steve Ognibene, and Roman Nuritdinov (Ky6uk).
FAQs
TypeScript definitions for big.js
The npm package @types/big.js receives a total of 551,606 weekly downloads. As such, @types/big.js popularity was classified as popular.
We found that @types/big.js demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.